const path = require('path')
const fs = require('fs')
const ex = new Map()
const bathPath =
  '/home/daiguoliang/Documents/git/PFMS-AllInOne/build/linux-unpacked/resources/node_modules'
const init = () => {
  loopFolder(bathPath)
}
const loopFolder = folderPath => {
  const dirs = fs.readdirSync(folderPath)
  dirs.forEach(innerItem => {
    if (fs.lstatSync(path.join(folderPath, innerItem)).isDirectory()) {
      loopFolder(path.join(folderPath, innerItem))
    } else if (
      !(
        innerItem.substring(innerItem.length - 3, innerItem.length) === '.js' ||
        innerItem.substring(innerItem.length - 5, innerItem.length) === '.json'
      )
    ) {
      const arr = innerItem.split('.')
      console.log(folderPath)
      if (arr.length > 0) {
        console.log(arr[arr.length - 1])
      } else {
        console.log(innerItem)
      }
    }
  })
}
init()
